package com.hebeiwangxiaozhang.response;

public class ResponseUtils {
    public static CommonResponse okResponse (Object content) {
        return CommonResponse.builder()
                .code(ResponseCode.SUCCESS.getCode())
                .message(ResponseCode.SUCCESS.getMessage())
                .content(content)
                .build();
    }

    public static CommonResponse failResponse (Integer code, Object content, String errorMsg) {
        return CommonResponse.builder()
                .code(code)
                .message(errorMsg)
                .content(content)
                .build();
    }

    public static CommonResponse okCreatedResponse () {
        return CommonResponse.builder()
                .code(ResponseCode.SUCCESS.getCode())
                .message(ResponseCode.SUCCESS.getMessage())
                .content("created")
                .build();
    }

    public static CommonResponse okDeletedResponse () {
        return CommonResponse.builder()
                .code(ResponseCode.SUCCESS.getCode())
                .message(ResponseCode.SUCCESS.getMessage())
                .content("deleted")
                .build();
    }

    public static CommonResponse okUpdatedResponse () {
        return CommonResponse.builder()
                .code(ResponseCode.SUCCESS.getCode())
                .message(ResponseCode.SUCCESS.getMessage())
                .content("updated")
                .build();
    }
}
